package com.fy.fyai.controller;

import com.fy.fyai.common.config.AiModelManager;
import com.fy.fyai.common.config.MultiModelManager;
import com.fy.fyai.common.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * AI模型管理Controller
 *
 * @author fwq
 * @date 2025-10-25
 */
@Tag(name = "AI模型管理")
@Slf4j
@RestController
@RequestMapping("/ai/model")
public class AiModelController {

    @Resource
    private AiModelManager aiModelManager;

    @Resource
    private MultiModelManager multiModelManager;

    /**
     * 获取所有可用的模型列表
     */
    @Operation(summary = "获取所有可用的模型列表")
    @GetMapping("/list")
    public R<List<String>> getModelList() {
        return R.ok(aiModelManager.getAvailableModels());
    }


    /**
     * 获取Ollama模型列表
     * @return Ollama模型列表
     */
     @Operation(summary = "获取Ollama模型列表")
     @GetMapping("/ollama/list")
     public Object getOllamaModelList() {
         return multiModelManager.getOllamaModel();
     }

    /**
     * 获取OpenAI模型列表
     * @return OpenAI模型列表
     */
    @Operation(summary = "获取OpenAI模型列表")
    @GetMapping("/openai/list")
    public Object getOpenAiModelList() {
        return multiModelManager.getOpenAiModel();
    }
}